package com.oracle.oa.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.dao.DataAccessException;

import com.oracle.oa.dao.CalendarDao;
import com.oracle.oa.entity.Calendar;

public class CalendarDaoImpl extends BaseDaoImpl implements CalendarDao {

	@SuppressWarnings("unchecked")
	
	public List<Calendar> findBytiem(String propertyName,String value) {
		
		List<Calendar> list=null;
		
		String hql="from Calendar c where c.start like '%"+value+"%'";
		
		try {
			list = this.getAllByHQL(hql);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		/*try {
			DetachedCriteria dc=DetachedCriteria.forClass(Calendar.class); 
			dc.add(Restrictions.like(propertyName, value));
			list=this.getHibernateTemplate().findByCriteria(dc);
		} catch (DataAccessException e) {
			e.printStackTrace();
		}*/
		
		return list;
	}

}
